﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using BLL;
using Entity;

namespace BookStore.Controllers
{
    public class HomeController : Controller
    {
        //
        // GET: /Home/
        //主页
        //首页
        public ActionResult Index()
        {
            //首页
            List<BookInformatica> list = BLL.Z_Book.GetBooks();
            ViewBag.bk = list;
            //菜单
            List<BookType> clist = BLL.Z_Book.GetCaiDan();
            ViewBag.caidan = clist;
            //二级菜单
            List<BookType> alist = BLL.Z_Book.GetCaiDan();
            ViewBag.caidane = alist;
            return View();
        }
        //子集分类
        public JsonResult aaa() 
        {
            return Json(Z_Book.GetCaiDan(),JsonRequestBehavior.AllowGet);
        }
        //模糊查询   首页查询图书功能
        public JsonResult s(string name)
        {
            List<BookInformatica> list = new List<BookInformatica>();
            list = BLL.Z_Book.Getmohu(name);
            return Json(list,JsonRequestBehavior.AllowGet);
        }
      
        //根据图书分类来查询图书
        public ActionResult fennei(int Typeid)
        {
            List<BookInformatica> list = BLL.Z_Book.Getfn(Typeid);
            ViewBag.fl = list;
            return View();
        }
        [HttpPost]
        public ActionResult fennei(string index_none_header_sysc)
        {
            ViewBag.fl = BLL.Z_Book.Getmohu(index_none_header_sysc);
            return View();
        }
    }
}
